package com.xdq.spring.service;

import com.xdq.spring.model.Light;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Service
@Scope("singleton")
public class LightProducer {

    private List<Light> engines = new ArrayList<>();

    public LightProducer(){
        System.out.println("LightProducer被实例化了");
    }

    public List<Light> produces(String type,int count) {
        for (int i = 0; i < count; i++) {
            Light light = new Light();
            light.setType(type);
            light.setWallt("20");
            light.setBrand("WW");
            light.setCreateDate(String.valueOf(System.currentTimeMillis()));
            light.setSerialNo(UUID.randomUUID().toString());
            engines.add(light);
        }
        return engines;
    }
}
